package com.zlc.study.controller;

import cn.hutool.core.date.DateUtil;
import com.zlc.study.service.ChatPersistenceAssistant;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class ChatPersistenceController {
    @Resource
    private ChatPersistenceAssistant chatPersistenceAssistant;

    @GetMapping("/chatpersistence/redis")
    public String redis(){
        chatPersistenceAssistant.chat(1L,"你好我的名字是zlc");
        chatPersistenceAssistant.chat(1L, "你好！我的名字是redis");

        String chat = chatPersistenceAssistant.chat(1L,"我的名字是什么？");
        System.out.println(chat);

        String chat1 = chatPersistenceAssistant.chat(2L,"介绍一下我");
        System.out.println(chat1);

        return "testChatPersistenceAssistant success:"+ DateUtil.now();

    }
}
